<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:w="http://www.apusic.com/jsf/widget" xmlns:layout="http://www.apusic.com/jsf/layout"
	xmlns:ajax="http://www.apusic.com/jsf/ajax" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:kd="http://www.kingdee.com/jsf/component"	xmlns:biz="http://www.kingdee.com/jsf/biz" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:om="http://www.apusic.com/jsf/misc" renderKitId="AJAX">
	<w:head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="Pragma" content="no-cache"/>
    	<meta http-equiv="Cache-Control" content="no-cache"/>
    	<meta http-equiv="Expires" content="0"/>
		<title>附件管理</title>
		<w:stylesheet src="/resource/common.css" />
		<w:script src="/resource/common.js" />
		<script type="text/javascript">
		//<![CDATA[
			function confirmDelete() {
				var msg = "确定要删除吗?";
				if(!confirm(msg)) return false;
			}
			
			function uploadDisplay() {
				var tbobj=document.getElementById("uploadDisplay");
				tbobj.style.display="";
			}
			
			function refreshList() {
				window.setTimeout("toggleBtnDisabled(false);", 1000);
				window.setTimeout("ajaxFuncInvoke(btnGridRefresh);", 50);
			}
			
			function toggleBtnDisabled(flag) {
				if(flag) {
					btnUpload.disable();
				} else {
					btnUpload.enable();
				}
			}

			function format(value) {					 
				 return "<a href='download.jsp?bosID="+value+"' target='_blank'>" + value + "</a>";
			}
			
			window.onbeforeunload = function(){
				if (document.all) {// only ie have it
					if(window.dialogArguments != null && window.dialogArguments != "undefined" &&
						typeof(window.dialogArguments.refreshAttMgt) != "undefined") {
						window.dialogArguments.refreshAttMgt();
					}
					if(window.opener != null && window.opener != "undefined" &&
						typeof(window.opener.refreshAttMgt) != "undefined") {
						//alert("now refresh!");
						window.opener.refreshAttMgt();
					}
				} else {
					if(window.opener != null && window.opener != "undefined" &&
						typeof(window.opener.refreshAttMgt) != "undefined") {
						window.opener.refreshAttMgt();
					}
				}
			}
		//]]> 
		</script>
	</w:head>
	<w:page loadMask="true">
		<om:useBean value="winlet.WebAttachmentBean"></om:useBean>
		<table width="100%">
		<w:form id="myForm" enctype="multipart/form-data"><tr>
		<td width="25%"><w:fileUpload id="fileUpload2" disabled="#{winlet.WebAttachmentBean.btnAddFlag}" uploadListener="#{winlet.WebAttachmentBean.processUpload}" rich="false" maxSize="10240k" /></td>
		<td width="4%" onclick="uploadDisplay()"><w:button id="btnUpload" jsvar="btnUpload" disabled="#{winlet.WebAttachmentBean.btnAddFlag}" action="#{winlet.WebAttachmentBean.action}" onclick="toggleBtnDisabled(true);" value="上传" /></td>
		<td width="46%">
		<div id="uploadDisplay" style="display:none"><w:fileUploadProgress startMessage="开始上传" uploadingMessage="正在上传，已经上传{readBytes}k/{total}k({percentage}%)" completeMessage="上传结束，总共{total}k" errorMessage="{error}" />
		</div>
		</td>
		<td width="25%"></td>
		</tr></w:form>
		<tr><td colspan="4">
		<kd:msgArea style=""></kd:msgArea>
		<w:form>
			<w:toolBar>
					<w:button value="查看" allowReEnter="false" actionBinding="#{winlet.WebAttachmentBean.viewAction}" />
					<w:button id="btnDelete" value="删除" disabled="#{winlet.WebAttachmentBean.btnFlag}" allowReEnter="false" actionBinding="#{winlet.WebAttachmentBean.deleteAction}" onclick="return confirmDelete();"/>
					<w:button value="刷新" allowReEnter="false" action="#{winlet.WebAttachmentBean.refresh}" />
			</w:toolBar>			
		       <div style="height:350px;">  
					<w:dataGrid id="grid" paged="true" rows="20" style="height:350px;width:1024px" 
			             binding="#{winlet.WebAttachmentBean.grid}" value="#{winlet.WebAttachmentBean.pagedListData}" var="reqInfo">
			             <ajax:action event="ondblclick" action="#{winlet.WebAttachmentBean.viewSelectedModel}"></ajax:action>
			             <w:outputColumn header="附件编号" clientFormatter="format" id="attachID" value="#{reqInfo['attachID']}" width="160"></w:outputColumn>
			             <w:outputColumn header="附件选择" id="boAttchAsso_assoType" value="#{reqInfo['boAttchAsso.assoType']}" width="100"></w:outputColumn>
			             <w:outputColumn header="附件文件名" id="name" value="#{reqInfo['name']}" width="300"></w:outputColumn>
			             <w:outputColumn header="文件类型" id="type" value="#{reqInfo['type']}" width="140"></w:outputColumn>
			             <w:outputColumn header="文件大小" id="size" value="#{reqInfo['size']}" width="80"></w:outputColumn>
			             <w:outputColumn header="附件说明" id="description" value="#{reqInfo['description']}" width="100"></w:outputColumn>
			             <w:outputColumn header="是否共享" id="sharedDesc" value="#{reqInfo['sharedDesc']}" width="30"></w:outputColumn>
			             <w:outputColumn header="创建时间" id="createTime" value="#{reqInfo['createTime']}" width="70"></w:outputColumn>
					</w:dataGrid>
					<w:button jsvar="btnGridRefresh" value="" action="#{winlet.WebAttachmentBean.refreshAttachmentList}" style="display:none" />
		       </div>
		</w:form>
		</td></tr>
		<tr><td>
				   <biz:innerWindow beanName="#{winlet.WebAttachmentBean}"></biz:innerWindow>
		</td></tr>
		</table>
		
	</w:page>
</f:view>